package logic.manager
{
	import common.core.UIService;
	
	import logic.UIProxyBag.componentProxy.*;
	import logic.UIProxyBag.uieditescene.*;

	public class UIProxy
	{
		private static var m_uiProxyGroup : Vector.<UIService> = new Vector.<UIService>;
		private static var m_pop : Object = new Object;
		
		private static function Instance(xmlClass : Class,pop : Boolean = true) : *
		{
			m_uiProxyGroup.push(new xmlClass);
			m_pop[xmlClass["prototype"]["constructor"]] = pop;
			
			return m_uiProxyGroup[m_uiProxyGroup.length - 1];
		}
		
		public static function stopAll() : void
		{
			for(var i:int=0;i<m_uiProxyGroup.length;i++)
			{
				if(m_uiProxyGroup[i]["constructor"])
				{
					if(m_pop[m_uiProxyGroup[i]["constructor"]])
					{
						m_uiProxyGroup[i].stop();
					}
				}
			}
		}
		
		public static const Button : ButtonProxy  = Instance(ButtonProxy);
		public static const CheckBox : CheckBoxProxy = Instance(CheckBoxProxy);
		public static const ComboBox : ComboBoxProxy = Instance(ComboBoxProxy);
		public static const DataGrid : DataGridProxy = Instance(DataGridProxy);
		public static const Image : ImageProxy = Instance(ImageProxy);
		public static const Label : LabelProxy = Instance(LabelProxy);
		public static const List : ListProxy = Instance(ListProxy);
		public static const TextArea : TextAreaProxy = Instance(TextAreaProxy);
		public static const TextInput : TextInputProxy = Instance(TextInputProxy);
		public static const UIFrame : UIFrameProxy = Instance(UIFrameProxy);
		public static const UILoader : UILoaderProxy = Instance(UILoaderProxy);
		public static const SimpleBtn : SimpleBtnProxy = Instance(SimpleBtnProxy);
		public static const Tree : TreeProxy = Instance(TreeProxy);
		public static const ScrollPane : ScrollPaneProxy = Instance(ScrollPaneProxy);
		public static const DataGridCols : DataGridColsProxy = Instance(DataGridColsProxy);
		public static const ToggleButton : ToggleButtonProxy = Instance(ToggleButtonProxy);
		
		public static const SanUITree : ScanUITreeProxy = Instance(ScanUITreeProxy,false);
		public static const ScanComponent : ScanComponentProxy = Instance(ScanComponentProxy,false);
		public static const UIContain : UIContainProxy = Instance(UIContainProxy,false);
		public static const TopBar : TopBarProxy = Instance(TopBarProxy,false);
	}
}